// import { ref } from 'vue'
// import { getSysTime } from '@/api/system'

let timer:any = null
const resize = (width: number, rem: number) => {
    clearTimeout(timer)
    timer = setTimeout(() => {
        // eslint-disable-next-line no-mixed-operators
        document.getElementsByTagName('html')[0].style.fontSize = `${document.body.offsetWidth / (width * 100) * rem}px`
    }, 200)
}

const screenInit = () => {
    document.getElementsByTagName('html')[0].style.fontSize = `${document.body.offsetWidth / (1920 * 100) * 100}px`
    window.onresize = () => {
        resize(1920, 100)
    }
}

// let timeDiff = 0
// const timeStamp = ref(new Date().getTime())
// getSysTime().then((r: any) => {
//     const sysTime = new Date(r.data).getTime()
//     const newTime = new Date().getTime()
//     timeDiff = sysTime - newTime
// }).catch((e: any) => { })

// setInterval(() => {
//     timeStamp.value = new Date().getTime() - timeDiff
// }, 1000)
export {
    screenInit
    // timeStamp
}
